package com.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;

public class Student extends Model<Student>{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static Student dao=new Student();
	
	/**
	 * 查找学生系别
	 */
	public Integer selectStuDep(int stuId)
	{
		return Student.dao.findById(stuId).getInt("student_department");
	}
	
	
	/**
	 * 查找学生对应的教学秘书id
	 */
	public Integer selectStu_DepSecId(int stuId)
	{
		int depId=Student.dao.selectStuDep(stuId);
		return Teacher.dao.selecSecId(depId);
	}
	
	/**
	 * 根据学生姓名学号查询学生id
	 * @param stuName
	 * @param stuNum
	 * @return
	 */
	public Integer searchStuId(String stuName, String stuNum)
	{
		Integer stuId;
		String sql="SELECT student_id from student where student_no='"+stuNum+"' and student_name='"+stuName+"'";
		stuId=Student.dao.findFirst(sql).getInt("student_id");
		return stuId;
	}
}
